<?php
$base_dir = str_replace( DIRECTORY_SEPARATOR , '/' , dirname( dirname( __FILE__ ) ) );
$js_dir = $base_dir . '/themes/';
$libs_dir = $base_dir . '/script/';
$editor_dir = $base_dir . '/sysadm/editor/bueditor/';

$libs_js = $_GET['libs']?explode(',', trim($_GET['libs'])):null;
$admin_js = $_GET['admin']?explode(',', trim($_GET['admin'])):null;
$editor_js = $_GET['editor']?explode(',', trim($_GET['editor'])):null;

// Load Library Script
loadjs($libs_js, $libs_dir);

// Load Admin Script
loadjs($admin_js, $js_dir . 'admin/js/');

// Load BUEditor
loadjs($editor_js, $editor_dir);

// Load Javascript
function loadjs($js,$dir){
	if($js){
		foreach($js as $j){
			$js_name = $dir . $j . '.js';
			if(file_exists($js_name))
				include $js_name;
		}
	}
}